package ooday02;

/**
 * 继承的
 */
public class ExtendsTest {
    public static void main(String[] args) {
        Student zg=new Student();
        zg.name="张光";
        zg.age=28;
        zg.address="广西";
        zg.className="jsd2404";
        zg.stuId="001";
        zg.eat();
        zg.sleep();
        zg.study();

        Student ll=new Student("李林",24,"北京","jsd2121","002");
        ll.eat();
        ll.sleep();
        ll.study();
        zg.sayHi();

        Teacher zl=new Teacher("赵亮",25,"河南",60000.0);
        zl.eat();
        zl.sleep();
        zl.sayHi();
        zl.teach();

        Doctor sxy=new Doctor("孙晓宇",23,"安徽","主治医师");
        sxy.eat();
        sxy.sleep();
        sxy.sayHi();
        sxy.cut();

        //演示超类不能访问派生类的
        Person p=new Person();
        p.name = "人";
        p.age = 1;
        p.address = "未知";
        p.eat();
        p.sleep();
        p.sayHi();
        //p.stuId = "005"; //编译错误，超类不能访问派生类的
    }
}
